/*
 *  This file is part of JSmex.
 *
 *  JSmex is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  JSmex is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *  @author Tobias Senger
 */
    

package jsmex.function;

public class FileProperties {
	
    private int filesize = 0;
    private boolean isDf = false;
    private int tof = 0;  // Type of File: 1:transparent; 2:linear fixed; 4:linear variable; 6:cyclic; 38:DF;
    private int record_length = 0;
    private int records = 0;
    private byte[] fid = new byte[2];
    private byte[] aid = null;
    private byte read_ac = 0x00;     //0x00: ALWAYAS;  0x0F: NEVER;  0x01:CHV1;  0x02:CHV2;
    private byte update_ac = 0x00;   //0x00: ALWAYAS;  0x0F: NEVER;  0x01:CHV1;  0x02:CHV2;
	
    public FileProperties(int size, int tof, int length, int records, byte[] fid, byte read, byte update) {
        this.filesize = size;
        this.isDf = (tof==0x38);
        this.tof = tof;
        this.record_length = length;
        this.fid[0] = fid[0];
        this.fid[1] = fid[1];
        this.read_ac = read;
        this.update_ac = update;
        this.records =records;
    }
    
    public void setAID(byte[] aid) {
        this.aid = new byte[aid.length];
        for (int i=0; i<aid.length; i++) {
            this.aid[i] = aid[i];
        }
    }
    
    public int getFileSize() { return filesize; }
    public boolean isDF() { return isDf; }
    public int getTof() {return tof;}
    public int getRecordLength() { return record_length; }
    public byte[] getFID() { return fid; }
    public byte[] getAID() { return aid; }
    public byte getReadAC() { return read_ac; }
    public byte getUpdateAC() { return update_ac; }
    public int getRecordsCount() { return records; }

} // end of Class

